import { defineStore } from "pinia";
import { ref, Ref } from "vue";
import { getAllRolesAPI } from "@/service/login/role";
import cache from "@/utils/cache";
export const useRoleStore = defineStore("role", {
  state: () => ({
    roles: ref([]) as Ref<any>,
  }),
  actions: {
    async getAllRoles() {
      const token = cache.getCache("token");
      const res = await getAllRolesAPI(token);
      this.roles.value = res.data;
    },
  },
});
